<%= page_title "Request access" %>
<%
  @projects = Project.all.order(:name)
  @roles = Role.all
%>
<section>
  <%= form_for @access_request, html: { class: "form-horizontal" } do |form| %>
    <%= redirect_to_field %>
    <%= form.input :manager_email, as: :email_field, required: true %>
    <%= form.input :reason, as: :text_area, required: true %>
    <%= form.input :project_ids, label: 'Projects', required: true do %>
      <%= live_select_tag 'access_request[project_ids]', options_from_collection_for_select(@projects, :id, :name),
          multiple: true %>
    <% end %>
    <%= form.input :role_id, required: true do %>
      <%= select_tag 'access_request[role_id]', options_from_collection_for_select(@roles, :id, :display_name),
          class: 'form-control' %>
    <% end %>
    <%= form.actions %>
  <% end %>
</section>
